from MHYSYW import *

# UI界面
window = tk.Tk()
window.title('原神圣遗物评分')
window.iconbitmap('PingCe.ico')
height = str(int(window.winfo_screenheight()*0.78))
width = str(int(window.winfo_screenmmwidth()*1.8*0.75))

#防止用户调整尺寸
window.resizable(0,0)

# 不知道为什么获取的宽度是我屏幕的1/4
window.geometry('{}x{}'.format(width, height))

# separtor是用来创建一个分割符的，就是标题下面的那根线
ttk.Separator(set_title(window, '原神圣遗物评分', 3.5), orient=tk.HORIZONTAL).pack(fill=tk.X)

# 占位置的画布
huabu = tk.Canvas(window, height=350)
huabu.create_line(0, 349, 515, 349, fill="#A0A0A0")
huabu.pack(side='top', fill='x')

# 标题 评分结果
ttk.Separator(set_title(window, '评分结果', 8), orient=tk.HORIZONTAL).pack(fill=tk.X)

# 多行文本 评分结果
evaluate_text = tk.Message(window, text='', font=('', 10), width=243)
evaluate_text.place(x=275, y=475)

# 下拉框
# 设置下拉框的初始值
value_1 = tk.StringVar()
value_1.set(combobox_values_1[0])
combobox_1 = ttk.Combobox(window, textvariable=value_1, state='readonly', width=16)
# 设置下拉框的选项
combobox_1['values'] = combobox_values_1
combobox_1.current(0)
# 绑定函数
combobox_1.bind('<<ComboboxSelected>>', change_value)
# 设置位置
combobox_1.place(x=40, y=85)

value_2 = tk.StringVar()
value_2.set('')
combobox_2 = ttk.Combobox(window, textvariable=value_2, state='readonly', width=12)
combobox_2.bind('<<ComboboxSelected>>', change_value)
combobox_2.place(x=179, y=85)

value_3 = tk.StringVar()
value_3.set('')
combobox_3 = ttk.Combobox(window, textvariable=value_3, state='readonly', width=15)
combobox_3.bind('<<ComboboxSelected>>', change_value)
combobox_3.place(x=289, y=85)

# 标题部分
set_title(window, '请选择圣遗物星级', 12, cod=[40, 55], mod='M')
set_title(window, '请选择圣遗物', 12, cod=[179, 55], mod='M')
set_title(window, '请选择圣遗物部位', 12, cod=[286, 55], mod='M')

# 按钮部分
search_button = tk.Button(master=window, text='确定', height=1, width=5, relief='groove', command=search)
search_button.place(x=420, y=82)

# 圣遗物效果
show_syw_effect = tk.Message(window, text='', font=('', 10), width=225)
show_syw_effect.place(x=10, y=305)

# 圣遗物tag的value
main_tag_value = tk.Entry(window, font=('', 10), width=10)
side_tag_1_value = tk.Entry(window, font=('', 10), width=10)
side_tag_2_value = tk.Entry(window, font=('', 10), width=10)
side_tag_3_value = tk.Entry(window, font=('', 10), width=10)
side_tag_4_value = tk.Entry(window, font=('', 10), width=10)

# 设置画布
canvas = tk.Canvas(window, width=260, height=1000)
# 绘制7边形
canvas.create_text(125, 40, text='元素充能效率')
canvas.create_text(198, 75, text='元素精通')
canvas.create_text(217, 154, text='攻击力')
canvas.create_text(168, 219, text='伤害加成')
canvas.create_text(86, 221, text='爆率/爆伤')
canvas.create_text(33, 159, text='防御力')
canvas.create_text(48, 79, text='生命值')
# 绘制分割线

window.mainloop()
